package com.ty.user.starter.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ty.user.starter.enums.LogTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统日志表
 * </p>
 *
 * @author minku
 * @since 2021-10-21
 */
@Getter
@Setter
@TableName("ty_log")
@ApiModel(value = "Log对象", description = "系统日志表")
public class Log implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty("创建用户编码")
    @TableField("create_user_id")
    private Long createUserId = 0L;

    @ApiModelProperty("创建用户名称")
    @TableField("create_user_name")
    private String createUserName = "";

    @ApiModelProperty("创建时间")
    @TableField("create_date")
    private LocalDateTime createDate;

    @ApiModelProperty("请求URI")
    @TableField("request_uri")
    private String requestUri;

    @ApiModelProperty("请求方式")
    @TableField("request_method")
    private String requestMethod;

    @ApiModelProperty("请求参数")
    @TableField("request_params")
    private String requestParams;

    @ApiModelProperty("请求IP")
    @TableField("request_ip")
    private String requestIp;

    @ApiModelProperty("请求服务器地址")
    @TableField("server_address")
    private String serverAddress;

    @ApiModelProperty("开始时间")
    @TableField("start_time")
    private LocalDateTime startTime;

    @ApiModelProperty("结束时间")
    @TableField("end_time")
    private LocalDateTime endTime;

    @ApiModelProperty("执行时间")
    @TableField("execute_time")
    private Long executeTime;

    @ApiModelProperty("用户代理")
    @TableField("user_agent")
    private String userAgent;

    @ApiModelProperty("操作系统")
    @TableField("device_name")
    private String deviceName;

    @ApiModelProperty("浏览器名称")
    @TableField("browser_name")
    private String browserName;

    /**
     * 以下为{@link com.ty.user.starter.annon.TyLog}注解的内容
     */
    @ApiModelProperty("操作模块")
    @TableField("module")
    private String module;

    @ApiModelProperty("操作类型")
    @TableField("type_enum")
    private LogTypeEnum typeEnum;

    @ApiModelProperty("操作说明")
    @TableField("description")
    private String description;

}
